using System.Collections;
using System.Collections.Generic;
using SoftKitty.MasterCharacterCreator;
using UnityEngine;
using static ItemData;

[System.Serializable]
    
/// <summary>
/// 代表一个物品的基础信息：
/// - 名称
/// - 图标（Sprite）
/// - 在背包中“宽度”（占几列）
/// - 在背包中“高度”（占几行）
/// </summary>
[CreateAssetMenu(fileName = "NewItemData", menuName = "创建物品数据/ItemData")]
public class Item : ScriptableObject
{
    [Tooltip("物品在网格中的宽度（占用几列）")]
    public int gridWidth = 1;
    [Tooltip("物品在网格中的高度（占用几行）")]
    public int gridHeight = 1;
    public WeaponController WeaponController;//如果是武器的话
    public EquipmentAppearance EquipmentAppearance;//如果是装备的话

    public ItemType ItemType;                   //物品类型
    public string ItemName;                     // 物品名称
    public string CustomName;                   //自定义名字
    public string Describe;                     //描述
    public List<Content> Content = new List<Content>();//元素含量信息
    public List<IncludesTypes> ProductionIncludes;            //制作需要包含的元素
    [HideInInspector]public int ItemID;                          // 物品ID
    public List<Part> Parts;                           //部位
    public int AttackPower;                     //攻击力
    // public Distance Scope;                           //范围
    public Target Target;                       //使用目标
    public Quality Quality;                         // 品质
    public int Price;                           //价格
    public List<int> Subcategory;       //子类别
    public Sprite icon;                         //图片信息

    public float MagicResistance;               //魔抗
    public float AntiPhysicalResistance;        //物抗
    public int Growth;                          //成长性
   
    [HideInInspector] public bool hasPlaced = false;  // 是否已经分配过行列
    [HideInInspector] public int placedRow;           // 放到的行索引
    [HideInInspector] public int placedCol;           // 放到的列索引
    
    public List<Item> Backpack;//背包数据
    public int rows;//背包行
    public int columns;//背包列
    public InventoryManager Inventory;//背包面板
    
}
[System.Serializable]
public class Content
{
    public ElementType ElementType;//元素类型
    public float num;//元素含量
}

[System.Serializable]
public class IncludesTypes
{
    public List<ElementType> ElementTypes;
}
[System.Serializable]
public enum ElementType
{
  [InspectorName("铁")]
  Iron,
  [InspectorName("木")]
  Tree,
  [InspectorName("金")]
  Gold,
  [InspectorName("石")]
  Stone,
  [InspectorName("亚麻")]
  Flax
}